<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/include/head.jsp"%>
<table id="dg" >
</table>

<div id="queryDialog" class="easyui-dialog" title="查询" style="width: 500px; height: 400px;"  
                 data-options="iconCls:'pag-list',modal:true,collapsible:false,minimizable:false,maximizable:false,resizable:false,closed:true,buttons:'#searchbb'">  
            <form action="" id="searchForm">
	            <table cellpadding="0" cellspacing="1" class="formtable">
								<tr>
				<td align="right"><label class="Validform_label">关键字:</label></td>
				<td class="value">
					<input class="easyui-textbox" type="text"  id="keyWord" name="keyWord"/>
				</td>
				</tr>
	            </table>  
            </form>
            <div style="text-align:right;margin-right:30px;"  id="searchbb">
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="btnSearch()">查询</a>  
                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="btnSearchCancel()">取消</a>  
            </div>                  
</div>
<script type="text/javascript">
	$(function() {
		$('#keyWord').textbox('textbox').keydown(function (e) {
            if (e.keyCode == 13) {
            	btnSearch();
            }
        });
		initCurdDatagrid('hRecvAddress','dg',{
			title:'收货地址',
			baseUrl:'',
			dwidth:'90%',//弹出对话框的宽度 百分比或者具体数字宽度
			dheight:'90%',//弹出对话框的高度 百分比或者具体数字宽度
			columns:[[    
				        {field:'cusCode',title:'编码',width:80,sortable:true},    
				        {field:'cusName',title:'客户名称',width:100,sortable:true},    
				        {field:'cusNameShort',title:'客户简称',width:100,sortable:true},
				        {field:'area',title:'区域',width:60,sortable:true},    
				        {field:'cusAddress',title:'客户地址',width:120,sortable:true},    
				        {field:'contractor',title:'联系人',width:50,sortable:true},    
				        {field:'telphone',title:'联系电话',width:80,sortable:true},    
				        {field:'cellphone',title:'联系手机',width:80,sortable:true},    
				        {field:'longitude',title:'经度',width:60,sortable:true},
				        {field:'latitude',title:'维度',width:60,sortable:true},    
				        {field:'userDefTude',title:'自定义维度',width:40,sortable:true}
				    ]] 
		},[{
			text: '设置经纬度', 
	        iconCls: 'icon-edit', 
	        handler: function() { 
	        	var selArr = $('#dg').datagrid('getSelections');
				if(selArr.length < 1)
				{
					$.messager.alert("验证结果","请选中一行数据",'error');
					return;
				}
				var ids = "";
				$.each(selArr, function(i,val){      
					ids += "," + val.id;
				 });
				KD.ajax({
					url:'updateLatLong.do',
					data:{ids:ids.substring(1)},
					success:function(){
						$.messager.alert("验证结果","设置成功",'info',function(){
							$('#dg').datagrid('reload')
						});
					}
				});
	        } 
			
		},'-']);

	});
	function btnSearchCancel()
	{
		$("#queryDialog").dialog('close');  
	}
	function btnSearch()
	{ 
		$('#dg').datagrid('load',$("#searchForm").serializeObject());
		$("#queryDialog").dialog('close');
	}
	
	function reloadData()
	{
		$('#dg').datagrid('reload');
	}
	
</script>

<%@include file="/include/foot.jsp"%>